
#include <valarray>
#include <iostream>

class Geometry
{
public:
    typedef int bm_t;//边界的编号类型为整型
protected:
    size_t index;//序号，-1意味着没有编序号
    bm_t boundary_mark; //边界编号值，0意味着边界都在计算区域内部
    std::valarray<size_t> vertex;//顶点的全局编号编号数组
    std::valarray<size_t> boundary;//边界（即边）的编号数组
    std::valarray<int> neighbor;//与该单元有公共边的单元编号
    std::valarray<size_t> dofs;//自由度的编号
public:
    virtual size_t get_index() const;
    virtual bm_t get_boundary_mark() const;
    virtual void set_index(size_t _idx);
    virtual void set_boundary_mark(bm_t _bm);
    virtual size_t get_n_vertex() const;
    virtual size_t get_n_boundary() const;
    virtual size_t get_n_neighbor() const;
    virtual size_t get_n_dofs() const;
    virtual void set_n_dofs(size_t _n);
    virtual void set_n_vertex(size_t _n);
    virtual void set_n_boundary(size_t _n);
    virtual void set_n_neighbor(size_t _n);
    virtual size_t get_vertex(size_t _i) const;
    virtual size_t get_boundary(size_t _i) const;
    virtual int get_neighbor(size_t _i) const;
    virtual size_t get_dofs(size_t _i) const;
    virtual const std::valarray<size_t>& get_dof() const;
    virtual void set_vertex(size_t _i, size_t _ivtx);
    virtual void set_boundary(size_t _i, size_t _ibnd);
    virtual void set_neighbor(size_t _i, size_t _inei);
    virtual void set_dof(size_t _i, size_t _idof);
    Geometry();
} ;
Geometry::Geometry(){
    index = -1;//意味着没有编号
    boundary_mark = 0;//意味着整个单元都在计算区域的内部
};
size_t Geometry::get_index() const{return index;};
Geometry::bm_t Geometry::get_boundary_mark() const{return boundary_mark;};
void Geometry::set_index(size_t _idx){ index = _idx;};
void Geometry::set_boundary_mark(bm_t _bm){ boundary_mark = _bm;};
size_t Geometry::get_n_vertex() const{return vertex.size(); };
size_t Geometry::get_n_boundary() const{return boundary.size();};
size_t Geometry::get_n_neighbor() const{return neighbor.size();};
size_t Geometry::get_n_dofs() const{return dofs.size();};
void Geometry:: set_n_dofs(size_t _n){dofs.resize(_n);};
void Geometry:: set_n_vertex(size_t _n){vertex.resize(_n);};
void Geometry:: set_n_boundary(size_t _n){boundary.resize(_n);};
void Geometry:: set_n_neighbor(size_t _n){neighbor.resize(_n);};
size_t Geometry:: get_vertex(size_t _i) const{return vertex[_i];};
size_t Geometry:: get_boundary(size_t _i) const{return boundary[_i];};
int Geometry:: get_neighbor(size_t _i) const{return neighbor[_i];};
size_t Geometry:: get_dofs(size_t _i) const{return dofs[_i];};
const std::valarray<size_t>& Geometry:: get_dof() const{return dofs;};
void Geometry:: set_vertex(size_t _i, size_t _ivtx){vertex[_i]= _ivtx;};
void Geometry:: set_boundary(size_t _i, size_t _ibnd){boundary[_i]=_ibnd;};
void Geometry:: set_neighbor(size_t _i, size_t _inei){neighbor[_i]=_inei;};
void Geometry:: set_dof(size_t _i, size_t _idof){dofs[_i] = _idof;};